Mady has an infinite number of balls and empty boxes available to her. The empty boxes, each capable of holding four balls, are arranged in a row from left to right. At the first step, she places a ball in the first box (the leftmost box) of the row. At each subsequent step, she places a ball in the first box of the row that still has room for a ball and empties any boxes to its left. How many balls in total are in the boxes as a result of Mady's $2010$th step?
Answer: After trying the first few steps, we notice that the boxes resemble the set of positive integers in quinary (base $5$). In particular, the first box corresponds to the units digit, the second corresponds to the fives digit, and so forth. An empty box corresponds to the digit $0$ and a box with $k$ balls, $1 \le k \le 4$ corresponds to the digit $k$.

We need to verify that this is true. On the first step, the boxes represent the number $1$. For the $n$th step, suppose that the units digit of $n$ in quinary is not equal to $4$, so that the first box is not full. The operation of adding $1$ in quinary simply increments the units digit of $n$ by $1$. Indeed, Mady performs the corresponding operation by adding a ball to the first box. Otherwise, if the units digit of $n$ in quinary is equal to $4$, suppose that the rightmost $m$ consecutive quinary digits of $n$ are equal to $4$. Then, adding $1$ to $n$ entails carrying over multiple times, so that the $m+1$th digit will be incremented once and the other $m$ digits will become zero. Mady does the same: she places a ball in the first available box (the $m+1$th), and empties all of the previous boxes.

It follows that the number of filled boxes on the $2010$th step is just the sum of the digits in the quinary expression for $2010$. Converting this to quinary, the largest power of $5$ less than $2010$ is $5^{4} = 625$, and that $3 < 2010/625 < 4$. Then, $2010 - 3 \cdot 625 = 135$. Repeating this step, we find that $$2010 = 3 \cdot 5^{4} + 1 \cdot 5^3 + 2 \cdot 5^1,$$ so the desired answer is $3 + 1 + 2 = \boxed{6}$.